package com.roy.eureka.client;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;

import feign.Retryer;

@SpringBootApplication
//@EnableEurekaClient
//hystrix
//@EnableCircuitBreaker
@EnableHystrix
@EnableHystrixDashboard
//@EnableDiscoveryClient
@EnableEurekaClient
//要加入basePackages才能扫描到api包中定义的Feign客户端
@EnableFeignClients(basePackages="com.roy.eureka")
//@EnableZuulProxy
public class EurekaClientApplication {
	private static final Logger logger = LoggerFactory.getLogger(EurekaClientApplication.class);

	public static void main(String[] args) {
		SpringApplication.run(EurekaClientApplication.class, args);
		logger.info("启动服务端注册服务!");
	}

	@Bean
	Retryer feignRetryer() {
		//配置feign失败不重试。保证等幂调用
		return Retryer.NEVER_RETRY;
	}

}
